package cn.gzsxt.music.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import cn.gzsxt.music.query.SingerQueryObject;

@Mapper
public interface SingerMapper {
	
	//查总数
	@SelectProvider(type=SingerProvider.class,method="selectSingerTotalByQo" )
	Long selectSingerTotalByCondition(SingerQueryObject qo);
	
	//查结果
	@SelectProvider(type=SingerProvider.class,method="selectSingerListByQo" )
	List<Map<String, Object>> selectSingerListByCondition(SingerQueryObject qo);
			
	
	//歌手插入
	@Insert("insert into mc_singer (singer_name,singer_gender,singer_hit,singer_debut,singer_like,singer_location,singer_birth,singer_info,singer_status,singer_visit)"
			+ " values (#{singer_name},#{singer_gender},#{singer_hit},#{singer_debut},#{singer_like},#{singer_location},#{singer_birth},#{singer_info},#{singer_status},#{singer_visit})")
	int insert(Map<String, Object> params);
			
	//歌手修改
	@Update("update mc_singer set singer_name = #{singer_name},singer_gender=#{singer_gender},singer_hit=#{singer_hit},singer_debut=#{singer_debut}"
			+ ",singer_like=#{singer_like},singer_location=#{singer_location},singer_birth=#{singer_birth},singer_info=#{singer_info},singer_status=#{singer_status},singer_visit=#{singer_visit} where singer_id = #{singer_id}")
	int update(Map<String, Object> params);
	
	//歌手删除
	@Delete("delete from mc_singer where singer_id = #{singer_id}")
	int deleteSingerById(Long singer_id);
		
	/**
	 * 检查歌手名是否重复
	 * 执行SingerProvider的动态sql语句
	 */
	@SelectProvider(type=SingerProvider.class,method="checkExistsSingerActionName")
	Map<String,Object> checkExistsSingerAction(Map<String,Object> params);

	

	

	
		
}
